package com.ruoyi.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.domain.ParkingRecordInOut;
import com.ruoyi.service.IParkingRecordInOutService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 车辆进出场记录(下级平台推送)Controller
 * 
 * @author ruoyi
 * @date 2025-11-21
 */
@RestController
@RequestMapping("/parking/recordInOut")
public class ParkingRecordInOutController extends BaseController
{
    @Autowired
    private IParkingRecordInOutService parkingRecordInOutService;

    /**
     * 查询车辆进出场记录(下级平台推送)列表
     */
    @PreAuthorize("@ss.hasPermi('parking:recordInOut:list')")
    @GetMapping("/list")
    public TableDataInfo list(ParkingRecordInOut parkingRecordInOut)
    {
        startPage();
        List<ParkingRecordInOut> list = parkingRecordInOutService.selectParkingRecordInOutList(parkingRecordInOut);
        return getDataTable(list);
    }

    /**
     * 导出车辆进出场记录(下级平台推送)列表
     */
    @PreAuthorize("@ss.hasPermi('parking:recordInOut:export')")
    @Log(title = "车辆进出场记录(下级平台推送)", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ParkingRecordInOut parkingRecordInOut)
    {
        List<ParkingRecordInOut> list = parkingRecordInOutService.selectParkingRecordInOutList(parkingRecordInOut);
        ExcelUtil<ParkingRecordInOut> util = new ExcelUtil<ParkingRecordInOut>(ParkingRecordInOut.class);
        util.exportExcel(response, list, "车辆进出场记录(下级平台推送)数据");
    }

    /**
     * 获取车辆进出场记录(下级平台推送)详细信息
     */
    @PreAuthorize("@ss.hasPermi('parking:recordInOut:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(parkingRecordInOutService.selectParkingRecordInOutById(id));
    }

    /**
     * 新增车辆进出场记录(下级平台推送)
     */
    @PreAuthorize("@ss.hasPermi('parking:recordInOut:add')")
    @Log(title = "车辆进出场记录(下级平台推送)", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ParkingRecordInOut parkingRecordInOut)
    {
        return toAjax(parkingRecordInOutService.insertParkingRecordInOut(parkingRecordInOut));
    }

    /**
     * 修改车辆进出场记录(下级平台推送)
     */
    @PreAuthorize("@ss.hasPermi('parking:recordInOut:edit')")
    @Log(title = "车辆进出场记录(下级平台推送)", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ParkingRecordInOut parkingRecordInOut)
    {
        return toAjax(parkingRecordInOutService.updateParkingRecordInOut(parkingRecordInOut));
    }

    /**
     * 删除车辆进出场记录(下级平台推送)
     */
    @PreAuthorize("@ss.hasPermi('parking:recordInOut:remove')")
    @Log(title = "车辆进出场记录(下级平台推送)", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(parkingRecordInOutService.deleteParkingRecordInOutByIds(ids));
    }
}
